package com.wanmait.meteor.controller;

import com.wanmait.meteor.service.CollectService;
import com.wanmait.meteor.util.IgnoreToken;
import com.wanmait.meteor.util.Result;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@IgnoreToken
@RestController
@CrossOrigin
public class CollectController {
    @Resource
    private CollectService collectService;

    //wf 通过会议id和用户id查询是否收藏
    @RequestMapping("web/selectIsCollect")
    //public Result  selectIsCollect(Integer meetId,Integer userinfoId){
    public Result  selectIsCollect(Integer meetId){
        int userinfoId=1;
        Boolean isCollect=collectService.selectIsCollect(meetId,userinfoId);
    return Result.success(isCollect);
    }
    //wf 添加收藏
    @RequestMapping("web/toCollect")
   // public Result toCollect(Integer meetId,Integer userinfoId){
    public Result toCollect(Integer meetId){
        int userinfoId=1;
        collectService.toCollect(meetId,userinfoId);
        return Result.success();

    }
    //wf 通过会议id和用户id删除对应的收藏
    @RequestMapping("web/delCollect")
    // public Result delCollect(Integer meetId,Integer userinfoId){
    public Result delCollect(Integer meetId){
        int userinfoId=1;
        collectService.delCollect(meetId,userinfoId);
        return Result.success();

    }
}
